package service

import (
	"context"
	"fmt"
	"google.golang.org/protobuf/types/known/emptypb"
	"grpcNacos/proto"
	"log"
)

type TestService struct{
	proto.UnimplementedTestServer
}

func (s TestService) Test(ctx context.Context, empty *emptypb.Empty) (*proto.TestResponse, error) {
	log.Println("收到一个请求")
	return &proto.TestResponse{Msg: "test"}, nil
}

type StuService struct{
	proto.UnimplementedStudentServer
}

func (s StuService) Learn(ctx context.Context, leq *proto.LearnReq) (*proto.LearnReply, error) {
	log.Println("收到一个请求")
	name := fmt.Sprintf("receive name:%v \n", leq.Id)
	return &proto.LearnReply{Name: name}, nil
}
